package chixing.day20.work4;

public class Order {
    private int orderId;
    private Location customerLocation;
    private double distanceToStore;
    private OrderPriority orderPriority;
    private int expectedDeliveryTime;
    private OrderStatus orderStatus;

    public Order() {}

    public Order(int orderId, Location customerLocation, double distanceToStore,
                 OrderPriority orderPriority, int expectedDeliveryTime) {
        this.orderId = orderId;
        this.customerLocation = customerLocation;
        this.distanceToStore = distanceToStore;
        this.orderPriority = orderPriority;
        this.expectedDeliveryTime = expectedDeliveryTime;
        this.orderStatus = OrderStatus.PENDING;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public Location getCustomerLocation() {
        return customerLocation;
    }

    public void setCustomerLocation(Location customerLocation) {
        this.customerLocation = customerLocation;
    }

    public double getDistanceToStore() {
        return distanceToStore;
    }

    public void setDistanceToStore(double distanceToStore) {
        this.distanceToStore = distanceToStore;
    }

    public OrderPriority getOrderPriority() {
        return orderPriority;
    }

    public void setOrderPriority(OrderPriority orderPriority) {
        this.orderPriority = orderPriority;
    }

    public int getExpectedDeliveryTime() {
        return expectedDeliveryTime;
    }

    public void setExpectedDeliveryTime(int expectedDeliveryTime) {
        this.expectedDeliveryTime = expectedDeliveryTime;
    }

    public OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(OrderStatus orderStatus) {
        this.orderStatus = orderStatus;
    }

    // 开始配送
    public void startDelivery() {
        this.orderStatus = OrderStatus.DELIVERING;
    }

    // 完成配送
    public void completeDelivery() {
        this.orderStatus = OrderStatus.COMPLETED;
    }

    // 取消订单
    public void cancelOrder() {
        this.orderStatus = OrderStatus.CANCELLED;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", customerLocation=" + customerLocation +
                ", distanceToStore=" + distanceToStore +
                ", orderPriority=" + orderPriority +
                ", expectedDeliveryTime=" + expectedDeliveryTime +
                ", orderStatus=" + orderStatus +
                '}';
    }
}
